package com.digitalchina.lxnsy.interfaces;

import android.app.Activity;
import android.content.Context;
import android.webkit.JavascriptInterface;

import com.digitalchina.lxnsy.activity.old.ExpertsDetailActivity;
import com.digitalchina.lxnsy.constant.URL;
import com.digitalchina.lxnsy.toolkit.GotoUtil;
import com.digitalchina.lxnsy.toolkit.StringUtil;
import com.digitalchina.lxnsy.xml.UserXML;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.interfaces
 * 创建人：郑皓
 * 创建时间：2017/9/12 11:29
 * 修改备注：
 * ================================================
 */
public class JavaScriptinterface {

    Context mContext;

    public JavaScriptinterface(Context context) {
        mContext = context;
    }

    @JavascriptInterface
    public void gotoExpertDetail(String id) {
        if (!StringUtil.isStrEmpty(id))
            GotoUtil.gotoActivity((Activity) mContext, ExpertsDetailActivity.class, "id", id);
    }


    /**
     * 与js交互时用到的方法，在js里直接调用的
     */
    @JavascriptInterface
    public void showShare() {
        String title = "中秋佳节，壕礼相送。";
        if (!StringUtil.isStrEmpty(UserXML.getInviteCode(mContext)))
            title += "我的邀请码：" + UserXML.getInviteCode(mContext);
        String content = "农科专家大回馈，呼朋唤友拿万元大奖，活动时间9.11-10.8，点击查看。";
        String shareUrl = URL.URL_SHARE_ACTIVITY;
        String imgUrl = URL.SERVER + "static/img/icon_app.png";
    }
}
